<?php
/**
 * common model file Created by PhpStorm.
 * User: wumengmeng
 * Date: 2020/05/07
 * Time: 18:17
 */

namespace HiCommon\Model;

class AccountSettlement extends Base
{
    
    protected $table = 'account_settlement';
    
    protected $guarded = [];
    
    //public $timestamps = false;
    
    /**
     * 应该被调整为日期的属性
     *
     * @var array
     */
    protected $dates = [
    ];

    /**
     * 获取图片可用链接
     *
     * @return array
     * @author wumengmeng <wu_mengmeng@foxmail.com>
     */
    public function getSettleTestifyImgAttribute($value)
    {
        $arr_data = [
          'src'=>$value,
          'full_src'=>oss_full_url($value),
        ];
        return $arr_data;
    }


    /**
     * 关联商户表
     *
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     * @author wumengmeng <wu_mengmeng@foxmail.com>
     */
    public function shop(){
        return $this->belongsTo(Shop::class,'shop_id')->select(['id','cate','name','company_name','logo']);
    }

    public function settle_order(){
        return $this->hasMany(AccountSettlementOrder::class,'account_settlement_id');
    }


    public function settle_coupon(){
        return $this->hasMany(AccountSettlementCoupon::class,'account_settlement_id');
    }




    
  
}